<%= form_for @identity, url: registrations_path, html: { class: "form-horizontal" } do |f| %>
  <fieldset>
    <legend>Register</legend>

    <% if @identity.errors.any? %>
    <div class="alert alert-block alert-error">
      <h4><i class="icon-warning-sign"></i> Error</h4>
      Please check the following <%= pluralize @identity.errors.size, "item" %>:
    </div>
    <% end %>

    <div class="control-group <%= form_error_class_for(f, :name) %>">
      <%= f.label :name, "Name", class: "control-label" %>
      <div class="controls">
        <div class="input-prepend">
          <span class="add-on"><i class="icon-user"></i></span>
          <%= f.text_field :name %>
        </div>
        <%= content_tag :span, "#{:name.to_s.humanize} #{f.object.errors[:name].to_sentence}", class: "help-inline" %>
      </div>
    </div>


    <div class="control-group <%= form_error_class_for(f, :email) %>">
      <%= f.label :email, "Email", class: "control-label" %>
      <div class="controls">
        <div class="input-prepend">
          <span class="add-on"><i class="icon-envelope"></i></span>
          <%= f.email_field :email %>
        </div>
        <%= content_tag :span, "#{:email.to_s.humanize} #{f.object.errors[:email].to_sentence}", class: "help-inline" %>
      </div>
    </div>

    <div class="control-group <%= form_error_class_for(f, :password_digest) %>">
      <%= f.label :password, "Password", class: "control-label" %>
      <div class="controls">
        <div class="input-prepend">
          <span class="add-on"><i class="icon-lock"></i></span>
          <%= f.password_field :password %>
        </div>
        <%= content_tag :span, "#{:password.to_s.humanize} #{f.object.errors[:password_digest].to_sentence}", class: "help-inline" %>
      </div>
    </div>

    <div class="control-group <%= form_error_class_for(f, :password) %>">
      <%= f.label :password_confirmation, "Confirmation", class: "control-label" %>
      <div class="controls">
        <div class="input-prepend">
          <span class="add-on"><i class="icon-lock"></i></span>
          <%= f.password_field :password_confirmation %>
        </div>
        <%= content_tag :span, "#{:password.to_s.humanize} #{f.object.errors[:password].to_sentence}", class: "help-inline" %>
      </div>
    </div>

    <div class="control-group">
      <div class="controls">
        <%= button_tag type: "submit", class: "btn btn-large btn-primary" do %>
          <i class="icon-ok icon-white"></i> Register
        <% end %>

        <%= link_to root_url, class: "btn btn-large" do %>
          <i class="icon-remove"></i> Cancel
        <% end %>
      </div>
    </div>
  </fieldset>
<% end %>
